<?php
	include "../config/db.php";
		
	$xmlobj = simplexml_load_string($xmltext);
 
	//version of the xml file and with parent tag
    $xmltext = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<catlog></catlog>";
   
	//creating a object to the string xml version	   
	$xmlobj = simplexml_load_string($xmltext);
	
	//adding a child to the parent catlog tag
	$categoryxml = $xmlobj->addChild("category","");
	
	$categoryxml->addChild("cid", "1001");
	$categoryxml->addChild("cname", "books321");
	$categoryxml->addChild("cdesc", "this dsfbook related to xml");
	
	$products = $categoryxml->addChild("products","");
	
	$product = $products->addChild("product","");
	
	$product->addChild("id","001");
	$product->addChild("name","php");
	$product->addChild("desc","th12323is is good book for php");
	
	echo  $xmlData = $xmlobj->asXML();
		
?>